<%@page import="org.book.service.UserService"%>
<%@page import="org.book.service.BookService"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="org.book.dao.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
	<%	//销毁
		request.getSession().removeAttribute("user_id");
		request.getSession().removeAttribute("book_id");
		
		
		String book_idStr = request.getParameter("book_id");
		String user_idStr = request.getParameter("user_id");
		int book = 0;
		int user = 0;
		if(book_idStr!=null&&user_idStr!=null){
			book = Integer.parseInt(book_idStr);
			user = Integer.parseInt(user_idStr);
		}else{
			request.getRequestDispatcher("../../index.jsp").forward(request, response);
			return ;
		}
		
		BookService bookService = new BookService();
		UserService userService = new UserService();
		BookBean bookBean = bookService.getStuByNo(book);
		UserBean userBean = userService.getStuByNo(user);
		
		//获取当前时间
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
		Date date = new Date(); 
		String time1 = formatter.format(date); 
		date.setDate(date.getDate()+3);
		String time2 = formatter.format(date); 
		
	%>
	<!-- 实际存储只需要rentTime returnTime book_id user_id四个数据即可 其他数据通过连接表获取 这里只起展示作用-->
	<form action="../../BorrowServlet?book_id=<%=book %>&user_id=<%=user %>" method="post">
		编号<input type="text"name="ISBN" value="<%=bookBean.getISBN()%>"><br>
		名称<input type="text" name="bookName" value="<%=bookBean.getBookName()%>"><br>
		价格<input type="text" name="price" value="<%=bookBean.getPrice()%>"><br>
		出版社<input type="text" name="press" value="<%=bookBean.getPress()%>"><br>
		作者<input type="text" name="author" value="<%=bookBean.getAuthor()%>"><br>
		用户姓名<input type="text" name="userName" value="<%=userBean.getUserName()%>"><br>
		用户卡号<input type="text" name="cardNumber" value="<%=userBean.getCardNumber()%>"><br>
		借阅时间<input type="text" name="rentTime" value="<%=time1%>"><br>
		归还时间<input type="text" name="returnTime" value="<%=time2%>"><br>
		<input type="submit"value="提交">
	</form>
</body>
</html>